import pygame,rendering,pygame._view
from entityManager import *
from gui import *
from rendering import *
import mapa
from vector import vector
from tower import *
from hud import *
import gui
class App:
    def __init__(self):
        self.running = True
        self.display = None
        self.eM = enM()
    def init(self):
        pygame.init()
        self.display = pygame.display.set_mode((800,600))
        self.running = True
        self.hud = hudBase(self.display)
        self.map = mapa.load_map2("hnatekmar",self.display)
    def event(self, event):
        if event.type == pygame.QUIT:
            self.running = False
            pygame.quit()
    def loop(self):
        pygame.display.flip()
    def cleanup(self):
        self.eM.__del__()
        pygame.quit()
    def execute(self):
        fps = pygame.time.Clock()
        if self.init() == False:
            self.running = False
        while(self.running):
            if fps.tick(25):
                self.display.fill((0,0,0))
                for event in pygame.event.get():
                    self.event(event)
                self.map.redraw()
                self.eM.update()
                self.loop()
        self.cleanup()
a = App()
a.execute()
